package factory;

import java.util.Optional;
import java.util.stream.Stream;

public class Factory {

    public static Calc getCalc(PowEnum pow){
        Optional<PowEnum> optional = Stream.of(PowEnum.values()).filter(item-> item.equals(pow)).findAny();
        if(optional.isPresent()){
            return optional.get().getStrategy();
        }
        throw new IllegalArgumentException("没有匹配的类型:"+pow);
    }
}
